package com.humngyang.com.hmy.study.mywx.Util;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;

public class XMLUtil {

    public static Document readXML(String str) {
        Document document = null;
        try {
            document = DocumentHelper.parseText(str);
        } catch (DocumentException e) {
            e.printStackTrace();
        }
        return document;
    }

    /**
     * 读取节点信息     * @param node     * @param name     * @return
     */
    public static String readNode(Element node, String name) {
        return node.element(name).getTextTrim();
    }

}
